home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Icon 8.1 / msm-2 / tests.sit / tests / stand / fncs.out < prev    next >
Encoding:
Text File  |  1992-12-08  |  11.1 KB  |  630 lines  |  [TEXT/????]

  1.  ----> &null
  2. copy(1) ----> 1
  3. copy("abc") ----> "abc"
  4. copy('aabbcc') ----> 'abc'
  5. copy(main) ----> procedure main
  6. copy([1,2,3]) ----> list_2(3)
  7. copy(table(0)) ----> table_2(0)
  8. copy() ----> &null
  9. copy(&input) ----> &input
  10. w := copy(write) ----> function write
  11. function write
  12. w(image(w)) ----> "function write"
  13. copy(array()) ----> record array_2(7)
  14. copy := copy(copy) ----> function copy
  15. x := copy(array) ----> record constructor array
  16. x := x(1,2,3,4,5,6,7) ----> record array_3(7)
  17. x[-4] ----> 4
  18. v := copy(c) ----> &null
  19. x := repl("123",4) ----> "123123123123"
  20. t := table() ----> table_3(0)
  21. every i := 1 to 100 do t[i] := i ----> none
  22. x := sort(t) ----> list_3(100)
  23. 1
  24. 2
  25. 3
  26. 4
  27. 5
  28. 6
  29. 7
  30. 8
  31. 9
  32. 10
  33. 11
  34. 12
  35. 13
  36. 14
  37. 15
  38. 16
  39. 17
  40. 18
  41. 19
  42. 20
  43. 21
  44. 22
  45. 23
  46. 24
  47. 25
  48. 26
  49. 27
  50. 28
  51. 29
  52. 30
  53. 31
  54. 32
  55. 33
  56. 34
  57. 35
  58. 36
  59. 37
  60. 38
  61. 39
  62. 40
  63. 41
  64. 42
  65. 43
  66. 44
  67. 45
  68. 46
  69. 47
  70. 48
  71. 49
  72. 50
  73. 51
  74. 52
  75. 53
  76. 54
  77. 55
  78. 56
  79. 57
  80. 58
  81. 59
  82. 60
  83. 61
  84. 62
  85. 63
  86. 64
  87. 65
  88. 66
  89. 67
  90. 68
  91. 69
  92. 70
  93. 71
  94. 72
  95. 73
  96. 74
  97. 75
  98. 76
  99. 77
  100. 78
  101. 79
  102. 80
  103. 81
  104. 82
  105. 83
  106. 84
  107. 85
  108. 86
  109. 87
  110. 88
  111. 89
  112. 90
  113. 91
  114. 92
  115. 93
  116. 94
  117. 95
  118. 96
  119. 97
  120. 98
  121. 99
  122. 100
  123. every write((!x)[2]) ----> none
  124. d
  125. d
  126. d
  127. cd
  128. cd
  129. cd
  130. cde
  131. cde
  132. cde
  133. bcde
  134. bcde
  135. bcde
  136. bcdef
  137. bcdef
  138. bcdef
  139. abcdef
  140. abcdef
  141. abcdef
  142. abcdef 
  143. abcdef0
  144. abcdef-
  145.  abcdef 
  146. 0abcdef0
  147. =abcdef-
  148.  abcdef  
  149. 0abcdef00
  150. =abcdef=-
  151.   abcdef  
  152. 00abcdef00
  153. =-abcdef=-
  154.   abcdef   
  155. 00abcdef000
  156. =-abcdef-=-
  157.    abcdef   
  158. 000abcdef000
  159. =-=abcdef-=-
  160.    abcdef    
  161. 000abcdef0000
  162. =-=abcdef=-=-
  163.     abcdef    
  164. 0000abcdef0000
  165. =-=-abcdef=-=-
  166.     abcdef     
  167. 0000abcdef00000
  168. =-=-abcdef-=-=-
  169.      abcdef     
  170. 00000abcdef00000
  171. =-=-=abcdef-=-=-
  172.      abcdef      
  173. 00000abcdef000000
  174. =-=-=abcdef=-=-=-
  175.       abcdef      
  176. 000000abcdef000000
  177. =-=-=-abcdef=-=-=-
  178.       abcdef       
  179. 000000abcdef0000000
  180. =-=-=-abcdef-=-=-=-
  181.        abcdef       
  182. 0000000abcdef0000000
  183. =-=-=-=abcdef-=-=-=-
  184. every write(center("abcdef",1 to 20," " | "0" | "=-")) ----> none
  185. a
  186. a
  187. a
  188. ab
  189. ab
  190. ab
  191. abc
  192. abc
  193. abc
  194. abcd
  195. abcd
  196. abcd
  197. abcde
  198. abcde
  199. abcde
  200. abcdef
  201. abcdef
  202. abcdef
  203. abcdef 
  204. abcdef0
  205. abcdef-
  206. abcdef  
  207. abcdef00
  208. abcdef=-
  209. abcdef   
  210. abcdef000
  211. abcdef-=-
  212. abcdef    
  213. abcdef0000
  214. abcdef=-=-
  215. abcdef     
  216. abcdef00000
  217. abcdef-=-=-
  218. abcdef      
  219. abcdef000000
  220. abcdef=-=-=-
  221. abcdef       
  222. abcdef0000000
  223. abcdef-=-=-=-
  224. abcdef        
  225. abcdef00000000
  226. abcdef=-=-=-=-
  227. abcdef         
  228. abcdef000000000
  229. abcdef-=-=-=-=-
  230. abcdef          
  231. abcdef0000000000
  232. abcdef=-=-=-=-=-
  233. abcdef           
  234. abcdef00000000000
  235. abcdef-=-=-=-=-=-
  236. abcdef            
  237. abcdef000000000000
  238. abcdef=-=-=-=-=-=-
  239. abcdef             
  240. abcdef0000000000000
  241. abcdef-=-=-=-=-=-=-
  242. abcdef              
  243. abcdef00000000000000
  244. abcdef=-=-=-=-=-=-=-
  245. every write(left("abcdef",1 to 20," " | "0" | "=-")) ----> none
  246. f
  247. f
  248. f
  249. ef
  250. ef
  251. ef
  252. def
  253. def
  254. def
  255. cdef
  256. cdef
  257. cdef
  258. bcdef
  259. bcdef
  260. bcdef
  261. abcdef
  262. abcdef
  263. abcdef
  264.  abcdef
  265. 0abcdef
  266. =abcdef
  267.   abcdef
  268. 00abcdef
  269. =-abcdef
  270.    abcdef
  271. 000abcdef
  272. =-=abcdef
  273.     abcdef
  274. 0000abcdef
  275. =-=-abcdef
  276.      abcdef
  277. 00000abcdef
  278. =-=-=abcdef
  279.       abcdef
  280. 000000abcdef
  281. =-=-=-abcdef
  282.        abcdef
  283. 0000000abcdef
  284. =-=-=-=abcdef
  285.         abcdef
  286. 00000000abcdef
  287. =-=-=-=-abcdef
  288.          abcdef
  289. 000000000abcdef
  290. =-=-=-=-=abcdef
  291.           abcdef
  292. 0000000000abcdef
  293. =-=-=-=-=-abcdef
  294.            abcdef
  295. 00000000000abcdef
  296. =-=-=-=-=-=abcdef
  297.             abcdef
  298. 000000000000abcdef
  299. =-=-=-=-=-=-abcdef
  300.              abcdef
  301. 0000000000000abcdef
  302. =-=-=-=-=-=-=abcdef
  303.               abcdef
  304. 00000000000000abcdef
  305. =-=-=-=-=-=-=-abcdef
  306. every write(right("abcdef",1 to 20," " | "0" | "=-")) ----> none
  307. center("",20,repl("x.",30)) ----> "x.x.x.x.x.x.x.x.x.x."
  308. left("",20,repl("x.",30)) ----> "x.x.x.x.x.x.x.x.x.x."
  309. right("",20,repl("x.",30)) ----> "x.x.x.x.x.x.x.x.x.x."
  310. a
  311. aa
  312. aaa
  313. aaaa
  314. aaaaa
  315. ab
  316. abab
  317. ababab
  318. abababab
  319. ababababab
  320. ba
  321. baba
  322. bababa
  323. babababa
  324. bababababa
  325. every write(repl("a" | "ab" | "ba",1 to 5)) ----> none
  326. repl("",0) ----> ""
  327. repl(&cset,0) ----> ""
  328. trim(&lcase) ----> "abcdefghijklmnopqrstuvwxyz"
  329. trim(&lcase,&lcase) ----> ""
  330. image(2) ----> "2"
  331. image('cab') ----> "'abc'"
  332. image(&lcase) ----> "&lcase"
  333. image('abcdefghijklmnopqrstuvwxyz') ----> "&lcase"
  334. image(&input) ----> "&input"
  335. image() ----> "&null"
  336. image(&null) ----> "&null"
  337. image([1,2,3]) ----> "list_104(3)"
  338. image([]) ----> "list_105(0)"
  339. image([,]) ----> "list_106(2)"
  340. image(table()) ----> "table_4(0)"
  341. image(table(3)) ----> "table_5(0)"
  342. image(list(0)) ----> "list_107(0)"
  343. image(set()) ----> "set_1(0)"
  344. image(set([1,2,3,3,3,3,3,4])) ----> "set_2(4)"
  345. image(repl) ----> "function repl"
  346. image(main) ----> "procedure main"
  347. image(repl(&lcase,10)) ----> "\"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\""
  348. image(array) ----> "record constructor array"
  349. image(a) ----> "&null"
  350. image(array) ----> "record constructor array"
  351. image(image) ----> "function image"
  352. string(2) ----> "2"
  353. string("2") ----> "2"
  354. string(" 2") ----> " 2"
  355. string("2 ") ----> "2 "
  356. string("+2") ----> "+2"
  357. string("-2") ----> "-2"
  358. string("- 2") ----> "- 2"
  359. string(" -    2 ") ----> " -    2 "
  360. string("") ----> ""
  361. string("--2") ----> "--2"
  362. string(" ") ----> " "
  363. string("-") ----> "-"
  364. string("+") ----> "+"
  365. string("22222222222222222222222222222222222222222222222222222222222") ----> "22222222222222222222222222222222222222222222222222222222222"
  366. string("7r4") ----> "7r4"
  367. string("4r7") ----> "4r7"
  368. string("4r 7") ----> "4r 7"
  369. string("7r 4") ----> "7r 4"
  370. string("16rff") ----> "16rff"
  371. string("36rcat") ----> "36rcat"
  372. string("36Rcat") ----> "36Rcat"
  373. string("36rCAT") ----> "36rCAT"
  374. string("1r1") ----> "1r1"
  375. string("2r0") ----> "2r0"
  376. type(0) ----> "integer"
  377. type("abc") ----> "string"
  378. type('aba') ----> "cset"
  379. type() ----> "null"
  380. type(&null) ----> "null"
  381. type([]) ----> "list"
  382. type(table()) ----> "table"
  383. type(main) ----> "procedure"
  384. type(write) ----> "procedure"
  385. type(array()) ----> "array"
  386. type(array) ----> "procedure"
  387. type(f) ----> "null"
  388. cset(2) ----> '2'
  389. cset("2") ----> '2'
  390. cset(" 2") ----> ' 2'
  391. cset("2 ") ----> ' 2'
  392. cset("+2") ----> '+2'
  393. cset("-2") ----> '-2'
  394. cset("- 2") ----> ' -2'
  395. cset(" -    2 ") ----> ' -2'
  396. cset("") ----> ''
  397. cset("--2") ----> '-2'
  398. cset(" ") ----> ' '
  399. cset("-") ----> '-'
  400. cset("+") ----> '+'
  401. cset("22222222222222222222222222222222222222222222222222222222222") ----> '2'
  402. cset("7r4") ----> '47r'
  403. cset("4r7") ----> '47r'
  404. cset("4r 7") ----> ' 47r'
  405. cset("7r 4") ----> ' 47r'
  406. cset("16rff") ----> '16fr'
  407. cset("36rcat") ----> '36acrt'
  408. cset("36Rcat") ----> '36Ract'
  409. cset("36rCAT") ----> '36ACTr'
  410. cset("1r1") ----> '1r'
  411. cset("2r0") ----> '02r'
  412. 1
  413. 2
  414. 3
  415. 4
  416. 5
  417. 6
  418. 7
  419. 8
  420. 9
  421. 10
  422. every write(seq()) \ 10 ----> none
  423. 2
  424. 3
  425. 4
  426. 5
  427. 6
  428. 7
  429. 8
  430. 9
  431. 10
  432. 11
  433. every write(seq(2)) \ 10 ----> none
  434. -10
  435. -9
  436. -8
  437. -7
  438. -6
  439. -5
  440. -4
  441. -3
  442. -2
  443. -1
  444. every write(seq(-10)) \ 10 ----> none
  445. 1
  446. 4
  447. 7
  448. 10
  449. 13
  450. 16
  451. 19
  452. 22
  453. 25
  454. 28
  455. every write(seq(,3)) \ 10 ----> none
  456.  ----> &null
  457. f := open("foo.baz","w") ----> file(foo.baz)
  458. write(f,"hello world") ----> "hello world"
  459. close(f) ----> file(foo.baz)
  460. F := open("gc1.icn") ----> file(gc1.icn)
  461. )(niam erudecorp
  462. { od 001 ot 1 yreve   
  463. )snoitcelloc&(etirw      
  464. od 001 ot 1 yreve      
  465. )0001(tsil         
  466. }      
  467. )"... gnitcelloc"(etirw   
  468. )(tcelloc   
  469. { od )0001 ot 1,"x"(lper =: s yreve   
  470. ))esacl&(gnirts(tesc      
  471. )(elbat =: t      
  472. )]s[(tes      
  473. ]5 : 2[s      
  474. }      
  475. dne
  476. every write(reverse(!F)) ----> none
  477. close(F) ----> file(gc1.icn)
  478. F := open("gc1.icn") ----> file(gc1.icn)
  479. procedure main()
  480.    every 1 to 100 do {
  481.       write(&collections)
  482.       every 1 to 100 do
  483.          list(1000)
  484.       }
  485.    write("collecting ...")
  486.    collect()
  487.    every s := repl("x",1 to 1000) do {
  488.       cset(string(&lcase))
  489.       t := table()
  490.       set([s])
  491.       s[2 : 5]
  492.       }
  493. end
  494. every write(map(!F)) ----> none
  495. close(F) ----> file(gc1.icn)
  496. F := open("gc1.icn") ----> file(gc1.icn)
  497. pr-c-d-r- m--n()
  498.    -v-ry 1 t- 100 d- {
  499.       wr-t-(&c-ll-ct--ns)
  500.       -v-ry 1 t- 100 d-
  501.          l-st(1000)
  502.       }
  503.    wr-t-("c-ll-ct-ng ...")
  504.    c-ll-ct()
  505.    -v-ry s := r-pl("x",1 t- 1000) d- {
  506.       cs-t(str-ng(&lc-s-))
  507.       t := t-bl-()
  508.       s-t([s])
  509.       s[2 : 5]
  510.       }
  511. -nd
  512. every write(map(!F,&cset || "aeiou",&cset || "-----")) ----> none
  513. close(F) ----> file(gc1.icn)
  514. F := open("gc1.icn") ----> file(gc1.icn)
  515. procedureumain()
  516. uuueveryu1utou100udou{
  517. uuuuuuwrite(&collections)
  518. uuuuuueveryu1utou100udo
  519. uuuuuuuuulist(1000)
  520. uuuuuu}
  521. uuuwrite("collectingu...")
  522. uuucollect()
  523. uuueveryusu:=urepl("x",1utou1000)udou{
  524. uuuuuucset(string(&lcase))
  525. uuuuuutu:=utable()
  526. uuuuuuset([s])
  527. uuuuuus[2u:u5]
  528. uuuuuu}
  529. end
  530. every write(map(!F,&cset || "     ",&cset || "aeiou")) ----> none
  531. close(F) ----> file(gc1.icn)
  532. f := open("gc1.icn") ----> file(gc1.icn)
  533. procedure main()
  534.    every 1 to 100 do {
  535.       write(&collections)
  536.       every 1 to 100 do
  537.          list(1000)
  538.       }
  539.    write("collecting ...")
  540.    collect()
  541.    every s := repl("x",1 to 1000) do {
  542.       cset(string(&lcase))
  543.       t := table()
  544.       set([s])
  545.       s[2 : 5]
  546.       }
  547. end
  548. while writes(reads(f)) ----> none
  549. close(f) ----> file(gc1.icn)
  550. f := open("gc1.icn") ----> file(gc1.icn)
  551. procedure main()
  552.    every 1 to 100 do {
  553.       write(&collections)
  554.       every 1 to 100 do
  555.          list(1000)
  556.       }
  557.    write("collecting ...")
  558.    collect()
  559.    every s := repl("x",1 to 1000) do {
  560.       cset(string(&lcase))
  561.       t := table()
  562.       set([s])
  563.       s[2 : 5]
  564.       }
  565. end
  566. while writes(reads(f,10)) ----> none
  567. f := open("gc1.icn") ----> file(gc1.icn)
  568. procedure main()
  569.    every 1 to 100 do {
  570.       write(&collections)
  571.       every 1 to 100 do
  572.          list(1000)
  573.       }
  574.    write("collecting ...")
  575.    collect()
  576.    every s := repl("x",1 to 1000) do {
  577.       cset(string(&lcase))
  578.       t := table()
  579.       set([s])
  580.       s[2 : 5]
  581.       }
  582. end
  583. while write(read(f)) ----> none
  584. close(f) ----> file(gc1.icn)
  585. 1
  586. 2
  587. 3
  588. 4
  589. 5
  590. 6
  591. 7
  592. 8
  593. 9
  594. 10
  595. 11
  596. 12
  597. 13
  598. 14
  599. 15
  600. 16
  601. 17
  602. 18
  603. 19
  604. 20
  605. 0.25  1.318 0.252 0.244 0.083 0.968 0.247 0.255 0.5   1.284 -1.38 -1.26 
  606. 0.5   1.047 0.523 0.463 0.165 0.877 0.479 0.546 0.707 1.648 -0.69 -0.63 
  607. 0.75  0.722 0.848 0.643 0.244 0.731 0.681 0.931 0.866 2.117 -0.28 -0.26 
  608. 1.0   0.0   1.570 0.785 0.321 0.540 0.841 1.557 1.0   2.718 0.0   0.0   
  609. 1.25              0.896 0.394 0.315 0.948 3.009 1.118 3.490 0.223 0.203 
  610. 1.5               0.982 0.463 0.070 0.997 14.10 1.224 4.481 0.405 0.369 
  611. 1.75              1.051 0.528 -0.17 0.983 -5.52 1.322 5.754 0.559 0.509 
  612. 2.0               1.107 0.588 -0.41 0.909 -2.18 1.414 7.389 0.693 0.630 
  613. 2.25              1.152 0.643 -0.62 0.778 -1.23 1.5   9.487 0.810 0.738 
  614. 2.5               1.190 0.694 -0.80 0.598 -0.74 1.581 12.18 0.916 0.834 
  615. 2.75              1.222 0.741 -0.92 0.381 -0.41 1.658 15.64 1.011 0.920 
  616. 3.0               1.249 0.785 -0.98 0.141 -0.14 1.732 20.08 1.098 1.0   
  617. 3.25              1.272 0.825 -0.99 -0.10 0.108 1.802 25.79 1.178 1.072 
  618. 3.5               1.292 0.862 -0.93 -0.35 0.374 1.870 33.11 1.252 1.140 
  619. 3.75              1.310 0.896 -0.82 -0.57 0.696 1.936 42.52 1.321 1.203 
  620. 4.0               1.325 0.927 -0.65 -0.75 1.157 2.0   54.59 1.386 1.261 
  621. 4.25              1.339 0.956 -0.44 -0.89 2.006 2.061 70.10 1.446 1.317 
  622. 4.5               1.352 0.982 -0.21 -0.97 4.637 2.121 90.01 1.504 1.369 
  623. 4.75              1.363 1.007 0.037 -0.99 -26.5 2.179 115.5 1.558 1.418 
  624. 5.0               1.373 1.030 0.283 -0.95 -3.38 2.236 148.4 1.609 1.464 
  625. 5.25              1.382 1.051 0.512 -0.85 -1.67 2.291 190.5 1.658 1.509 
  626. 5.5               1.390 1.071 0.708 -0.70 -0.99 2.345 244.6 1.704 1.551 
  627. 5.75              1.398 1.089 0.861 -0.50 -0.59 2.397 314.1 1.749 1.592 
  628. 6.0               1.405 1.107 0.960 -0.27 -0.29 2.449 403.4 1.791 1.630 
  629. 6.25              1.412 1.123 0.999 -0.03 -0.03 2.5   518.0 1.832 1.668 
  630.